import { SceneType } from "../../../../../../Core/Module/Entity/SceneType";
import { TimeHelper } from "../../../../../../Core/Module/Time/TimeHelper";
import { SerializeHelper } from "../../../../../../Core/Serialize/SerializeHelper";
import { MessageHandlerAttribute } from "../../../../../../Decorator/Decorator";
import { ETTask } from "../../../../../../Support/Share/Lib/Async/ETTask";
import { C2G_Ping, G2C_Ping } from "../../../../../Model/Generate/Share/Message/OuterMessage_C_10001";
import { AMRpcHandler } from "../../../../../Model/Server/Module/Message/AMRpcHandler";
import { ErrorCode } from "../../../../../Model/Share/Module/Message/ErrorCode";
import { Session } from "../../../../../Model/Share/Module/Message/Session";

@MessageHandlerAttribute(SceneType.All, C2G_Ping, G2C_Ping)
export class C2G_PingHandler extends AMRpcHandler<C2G_Ping, G2C_Ping> {

    protected async Run(session: Session, request: C2G_Ping, response: G2C_Ping) {
        response = SerializeHelper.PackMessage(G2C_Ping, response);
        response.Error = ErrorCode.ERR_Success;

        response.Time = TimeHelper.ServerNow();

        // console.log(`C2G_PingHandler`);
        // console.log(request);
        // console.log(response);

        await ETTask.CompletedTask;
    }

}